import React, { Component } from 'react';
import {
    View,
    Text,
    WebView,
    StyleSheet,

} from 'react-native';


class IDCard extends Component {
    state = {};


    static navigationOptions = ({ navigation, screenProps }) => ({
        // title: navigation.state.params?navigation.state.params.title:null,
        headerTitle:navigation.state.params.title ,
        headerStyle:{ backgroundColor: 'rgba(0,171,236,1)'},//导航栏的样式

});

    componentDidMount(){

        this.props.navigation.setParams({
            navigatePress:this.navigatePress
        })
    }

    navigatePress = () => {
        this.props.navigation.goBack();
    }

    render() {
        return (
            <WebView
                ref='webView'
                automaticallyAdjustContentInsets={false}
                style={styles.webView}
                source={{ uri: this.props.navigation.state.params.url }}
                javaScriptEnabled={true}
                domStorageEnabled={true}
                decelerationRate="normal"
                onNavigationStateChange={this.onNavigationStateChange}
                onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}
                startInLoadingState={true}
                scalesPageToFit={this.state.scalesPageToFit}
            />
        );
    }
}

export default IDCard;

const styles = StyleSheet.create({

    webView:{
        flex:1
    }

})

